import axios from 'axios'
import api from '../utils/index'

// 单个商品详情的数据
export const getGoods = (id) => api.get(`/goods?id=${id}`)
// 同类商品分类 轮播图 
export const shopBanner = ({
    id,
    limit
}) => api.get(`/goods/relevant`, {
    params: {
        id,
        limit
    }
})

// 热点的数据
export const findHotGoods = ({
    id,
    type,
    limit,
}) => api.get(`/goods/hot`, {
    params: {
        id,
        type,
        limit,
    }
})
// 请求商品评价筛选的接口
// axios  遇到 https 开头的不会加上基准地址 就是公共的开头
export const getComment = (id) => api.get(`https://mock.boxuegu.com/mock/1175/goods/${id}/evaluate`, )

// 商品评价的数据
export const getCommentPage = (id, {
    page,
    pageSize,
    hasPicture,
    tag,
    sortField,
}) => api.get(`https://mock.boxuegu.com/mock/1175/goods/${id}/evaluate/page`, {
    params: {
        page,
        pageSize,
        hasPicture,
        tag,
        sortField,
    }
})